<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改文件管理')" />
    <th:block th:include="include :: jasny-bootstrap-css" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-file-edit" th:object="${recordFile}" enctype="multipart/form-data">
            <input name="fileId" th:field="*{fileId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">文件名称：</label>
                <div class="col-sm-8">
                    <input name="fileName" th:field="*{fileName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">文号：</label>
                <div class="col-sm-8">
                    <input name="fileNo" th:field="*{fileNo}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">发文日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="fileDate" id="fileDate" class="form-control" placeholder="yyyy-MM-dd" type="text" th:field="*{fileDate}" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">文件类别：</label>
                <div class="col-sm-8">
                    <select name="fileType" class="form-control m-b" th:with="type=${@dict.getType('file_type')}">
                        <option value="">所有</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fileType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">文件类型：</label>
                <div class="col-sm-8">
                    <select name="fileModel" class="form-control m-b" th:with="type=${@dict.getType('file_model')}">
                        <option value="">所有</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fileModel}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">发文单位：</label>
                <div class="col-sm-8">
                    <input name="fileDept" th:field="*{fileDept}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">文件上传：</label>
                <div class="col-sm-8">
                    <div class="fileinput fileinput-new input-group" data-provides="fileinput">
                        <div class="form-control" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                        <span class="input-group-addon btn btn-white btn-file"><span class="fileinput-new">选择文件</span><span class="fileinput-exists">更改</span><input accept=".pdf" type="file" name="file"></span>
                        <a href="#" class="input-group-addon btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "record/file";
        $("#form-file-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var formData = new FormData($('#form-file-edit')[0]);
                $.operate.saveFile(prefix + "/edit", formData);
            }
        }
    </script>
</body>
</html>